package cn.zt.ztzx.service.impl;

import cn.zt.utils.Result;
import cn.zt.ztzx.domain.dto.DeviceDto;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.zt.ztzx.domain.Device;
import cn.zt.ztzx.service.DeviceService;
import cn.zt.ztzx.mapper.DeviceMapper;
import org.springframework.stereotype.Service;

/**
* @author 不.凌
* @description 针对表【t_device】的数据库操作Service实现
* @createDate 2024-09-27 09:52:13
*/
@Service
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device>
    implements DeviceService{

    @Override
    public Result deviceList(DeviceDto deviceDto) {
        Page<Device> page = new Page<>(deviceDto.getPageNum(), deviceDto.getPageSize());
        LambdaQueryWrapper<Device> wrapper= new LambdaQueryWrapper<>();
        this.page(page,wrapper);
        return Result.success(page);
    }

    @Override
    public Result deviceSave(Device device) {
        boolean save = this.save(device);
        return Result.success(save);
    }

    @Override
    public Result deviceDelete(Integer id) {
        boolean removeById = this.removeById(id);
        return Result.success(removeById);
    }

    @Override
    public Result deviceUpdate(Device device) {
        boolean b = this.updateById(device);
        return Result.success(b);
    }
}




